package prender;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
class MyResponse extends HttpServletResponseWrapper  {
	
	
	class MyWriter extends Writer {
		@Override
		public void write(char[] cbuf, int off, int len) throws IOException {
			MyResponse.this.webBuffer.write(cbuf, off, len);
		}

		@Override
		public void flush() throws IOException {
		}

		@Override
		public void close() throws IOException {
		}
	}
	
	MyResponse(HttpServletResponse response) {
		super(response);
	}
	
	@Override
	public PrintWriter getWriter() {
		return new PrintWriter(new MyWriter());
	}
	
	private WebBuffer webBuffer = null;
	WebBuffer getWebBuffer() {
		return webBuffer;
	}
	void setWebBuffer(WebBuffer webBuffer) {
		this.webBuffer = webBuffer;
	}
	
	

}
